package com.hiultra.archive.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hiultra.common.annotation.Log;
import com.hiultra.common.core.controller.BaseController;
import com.hiultra.common.core.domain.AjaxResult;
import com.hiultra.common.enums.BusinessType;
import com.hiultra.archive.domain.SysExamineConfig;
import com.hiultra.archive.service.ISysExamineConfigService;
import com.hiultra.common.utils.poi.ExcelUtil;
import com.hiultra.common.core.page.TableDataInfo;

/**
 * 审批配置Controller
 * 
 * @author ls
 * @date 2023-09-25
 */
@RestController
@RequestMapping("/base/sysExamineConfig")
public class SysExamineConfigController extends BaseController
{
    @Autowired
    private ISysExamineConfigService sysExamineConfigService;

    /**
     * 查询审批配置列表
     */
    @PreAuthorize("@ss.hasPermi('base:sysExamineConfig:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysExamineConfig sysExamineConfig)
    {
        startPage();
        List<SysExamineConfig> list = sysExamineConfigService.selectSysExamineConfigList(sysExamineConfig);
        return getDataTable(list);
    }

    /**
     * 导出审批配置列表
     */
    @PreAuthorize("@ss.hasPermi('base:sysExamineConfig:export')")
    @Log(title = "审批配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysExamineConfig sysExamineConfig)
    {
        List<SysExamineConfig> list = sysExamineConfigService.selectSysExamineConfigList(sysExamineConfig);
        ExcelUtil<SysExamineConfig> util = new ExcelUtil<SysExamineConfig>(SysExamineConfig.class);
        util.exportExcel(response, list, "审批配置数据");
    }

    /**
     * 获取审批配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('base:sysExamineConfig:query')")
    @GetMapping(value = "/{ examineConfigId}")
    public AjaxResult getInfo(@PathVariable(" examineConfigId") Long  examineConfigId)
    {
        return AjaxResult.success(sysExamineConfigService.selectSysExamineConfigByExamineConfigId(examineConfigId));
    }

    /**
     * 新增审批配置
     */
    @PreAuthorize("@ss.hasPermi('base:sysExamineConfig:add')")
    @Log(title = "审批配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysExamineConfig sysExamineConfig)
    {
        return toAjax(sysExamineConfigService.insertSysExamineConfig(sysExamineConfig));
    }

    /**
     * 修改审批配置
     */
    @PreAuthorize("@ss.hasPermi('base:sysExamineConfig:edit')")
    @Log(title = "审批配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysExamineConfig sysExamineConfig)
    {
        return toAjax(sysExamineConfigService.updateSysExamineConfig(sysExamineConfig));
    }

    /**
     * 删除审批配置
     */
    @PreAuthorize("@ss.hasPermi('base:sysExamineConfig:remove')")
    @Log(title = "审批配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ examineConfigIds}")
    public AjaxResult remove(@PathVariable Long[]  examineConfigIds)
    {
        return toAjax(sysExamineConfigService.deleteSysExamineConfigByExamineConfigIds( examineConfigIds));
    }
}
